package com.xbxkj.mix;
import com.xbxkj.mix.config.WebScoketService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import java.util.concurrent.ThreadPoolExecutor;


/**
 * spring-boot-plus 项目启动入口
 * @author geekidea
 * @since 2018-11-08
 */
@EnableScheduling
@MapperScan({"com.xbxkj.mix.mapper"})
@SpringBootApplication
@EnableCaching

public class SpringBootMixApplication {

    //springboot2.0开启websocket支持
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }
    public static void main(String[] args) {
        System.out.println("正在启动" );
        ConfigurableApplicationContext context = SpringApplication.run(SpringBootMixApplication.class, args);
       //解决websocket无法注入bean
        WebScoketService.setApplicationContext(context);
        System.out.println("启动成功" );


    }

}
